package com.example.whrdemospringboot.converter;

import com.example.whrdemospringboot.DTO.StudentDTO;
import com.example.whrdemospringboot.dao.Student;

public class StudentConverter {
    /**
     * 将用户的类转化为前端显示的类
     * @param student
     * @return
     */
    public static StudentDTO convertStudent(Student student) {
        StudentDTO studentDTO = new StudentDTO();
        studentDTO.setId(student.getId());
        studentDTO.setName(student.getName());
        return studentDTO;
    }

    public static Student converStudent(StudentDTO studentDTO){
        Student student = new Student();
        student.setId(studentDTO.getId());
        student.setName(studentDTO.getName());
        student.setEmail("");
        return student;
    }
}
